home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
016a
/
love4th.zip
/
SAVE.DOC
< prev
next >
Wrap
Text File
|
1991-10-01
|
5KB
|
102 lines
Saving the forth system
-----------------------
To save interactive forth system, simply type:
SAVE" filename.EXE"
SAVE" is in the TOOLBOX vocabulary (set by DEVELOP). It will
overwrite any file existing of the same name.
The word APPLICATION" is used to save final applications.
They are saved without heads or vocabulary stack. When re-started in
memory, the program has all the remaining segments (code, threads,
data, stack) compressed to the nearest paragraph. Note that this word
automatically returns the user to DOS. Usage:
ALSO UTILITIES
APPLICATION" filename.EXE" wordname
The Forth word QUIT (top level word) is redefined to execute
'wordname' followed by 'BYE'. In this way a single forth word becomes the
application. See also startup conditions below. For example:
APPLICATION" MYPROG.EXE" PROG-START-WORD
C> (dos prompt)
Allocating additional memory
----------------------------
When an exe file is loaded, DOS allocates enough memory for
the program and any additional that is requested in the exe header.
This is done in two stages. DOS looks at the minimum amount requested
(MINALLOC). If insufficient memory is available in the system to
satisfy this, DOS aborts with an error message. If the request is
satisfied, DOS allots up to the maximum amount requested (MAXALLOC).
If this is a very large number, DOS allots all the available memory.
For interactive forth (saved with SAVE") normally just enough
additional memory is allocated to leave room for the expansion of the
segments. For final applications, additional memory is allocated for
the stacks alone.
This can be increased by the programmer by storing the number
of requested paragraphs into the variables MINHEAP and MAXHEAP. These
are normally set to 0. Note that the actual starting segment for this
programmer requested area is returned by the word GET:HEAP . Note
that if MINHEAP exceeds MAXHEAP, MAXHEAP is set to the value of
MINHEAP.
Setting stack sizes
-------------------
Normally, 4k bytes are allocated for each of the parameter,
return, vocabulary, and local variable stacks. These sizes can be
changed as required by changing a table in the code segment. The
address in the code segment of this table is returned by STACKSIZE.
STACKSIZE 0 + CS:addr of size of parameter stack
STACKSIZE 2 + CS:addr of size of return stack
STACKSIZE 4 + CS:addr of size of vocabulary stack
The sum of these sizes must not exceed 64k bytes less the size
of any storage space allocated in the lower portion of the stack
segment (SS:HERE). The vocabulary stack size is set to 0
automatically by APPLICATION" . Any changes to this table become
effective on the next start-up of the system. Note also that in kernel
words, the return stack pointer is sometimes exchanged with the
parameter stack pointer.
Conditions on startup
---------------------
Both target applications and interactive forth:
- BASE set to DECIMAL
- S0 set to address of stack in SS:
- variable ATTRIBUTE set to 7
- DISPLAYADAPT sets variables CRTSEG and CRTPORT for current video card
- a minimum of MINHEAP paragraphs (spec'd on previous save) available
above GET:HEAP
- zero divide vector ( INT 0 ) pointing to execute ZERO-DIV
- control-break vector pointing to execute BRK-RETN
- if BLOCK words are installed, they are initialized
- source code loading handle stack is initialized
- printer flag is set to 0 (PR-OFF)
- variable WIDTH is set to 31
- variable WARNING is set to true
- the forth system 10 millisecond timer is set for
the speed of the present CPU
- executes word ONBOOT
- executes ABORT
Interactive forth only:
- clears display and prints logo
- sets vocabularies context: DEVELOP current: FORTH
- clears V-BODY to ensure no virtual vocabulary
- FIRST returns an address in high memory (VS:), LIMIT returns an address
404 hex * #BUFF above FIRST
- array TOPS contains highest usable addresses in each segment.
Target application only:
- all segments are packed together to the nearest greater segment,
based on their respective dictionary pointers
- no head segment is present
( HS:HERE GET:HS return undefined values)
- FIRST returns address 50 hex above PAD. LIMIT returns an address
404 hex * #BUFF above FIRST.
- array TOPS (highest addresses in each segment) is undefined.